﻿using Microsoft.VisualBasic;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace console.demo
{
    public class StreamWriterDemo
    {
        public StreamWriterDemo()
        {
        }

        public void get()
        {
            string[] names = new string[] { "zara ali", "nuha ali" };
            string lines = "";
            using (StreamWriter stream = new StreamWriter("test.text"))
            {
                foreach (string s in names)
                {
                    stream.WriteLine(s);
                }
            }
            string line = "";
            using (StreamReader stream = new StreamReader("test.txt"))
            {
                while ((line = stream.ReadLine()) != null)
                {
                    Console.WriteLine(line);
                }
            }
            Console.ReadKey();
        }
    }
}
